<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

// @filename   mflash.php

class mflash extends Model {

    function mflash() {
        parent::Model();
    }
    
    function get_flash_list(){
    	$this->db->order_by('forder asc, state desc');
    	$query = $this->db->get('index_flash');
    	return $query->result_array();
    }
    
    function insert_new_flash($array){
    	return $this->db->insert('index_flash',$array);
    }
    
    function update_flash_state($id,$state=1){
    	return $this->db->update('index_flash',array('state'=>$state),array('id'=>$id));
    }
    
    function delete_flash($id){
    	return $this->db->delete('index_flash',array('id'=>$id));
    }
    
    function update_flash_info($id,$data){
    	if($id && is_array($data)){
    		return $this->db->update('index_flash',$data,array('id'=>$id));
    	} else {
    		return FALSE;
    	}
    }
    
    function get_flash_info($id){
    	$query = $this->db->get_where('index_flash',array('id'=>$id));
    	return $query->row_array();
    }
}
?>